package com.gitee.wsl.ext.base
/*

import com.gitee.wsl.task.TimeTaskServer

import org.junit.Test

class TimeTaskServerTest {

    @Test
    fun testTimeTaskSever(){
       var countRun=0
       println("testTimeTaskSever start tick :$countRun")

       TimeTaskServer.tickRun {
           countRun++
           println("tick :$countRun")
           if(countRun>10) cancel()
       }

        TimeTaskServer.tickRun {
            countRun++
            println("two tick :$countRun")
            if(countRun>30) cancel()
        }

        TimeTaskServer.tickRun {
            countRun++
            println("... tick :$countRun")
            if(countRun>50) cancel()
        }

        TimeTaskServer.tickRun {
            countRun++
            println(".... tick :$countRun ")
            if(countRun==10) pause()
            if(countRun==40) reset()
            if(countRun>80) cancel()

        }

        Thread.sleep(1000*50)
    }

    @Test
    fun testDelayRun(){
        var countRun = 0

        TimeTaskServer.tickRun {
            countRun++
            println(".... tick :$countRun ")
            if(countRun==10) pause()
            if(countRun==40) reset()
            if(countRun>80) cancel()

        }

        TimeTaskServer.delayRun {
            (1..100).forEach { _ ->
                println(".... tick 1000 :${countRun++} ")
                Thread.sleep(10)
             }
        }

        TimeTaskServer.delayRun(2000) {
            (1..10).forEach { _ ->
                println(".... tick 2000:${countRun++} ")
                Thread.sleep(10)
            }
        }

        Thread.sleep(1000*10)
    }

    @Test
    fun testCronBuilder(){

        println(cronString{
            dayOfWeek {
                sunday()
            }
        })

         println(cron{
             year(1996)
             month { always() }
             dayOfWeek {
                 sunday()
             }
         }.asString())

        println(cron{
            year(1996)
            month { always() }
            dayOfWeek {
                sunday()
                lastWeekDay(4)

            }
            hour {
                everyLoop(2 everyLoop 3)
            }
        }.asString())

           val cron = cron {
                year(1982,1992,2001)
                hour { on(1..6) }
                dayOfWeek {
                    sunday()
                    saturday()
                    monday()
                }
                month { always()}
            }
        println(cron.asString())
    }

    @Test
    fun testCronDateTimeBuilder(){

        println("date:")
        println(cronString {
            date(currentDateTime)
        })

        println("time:")
        println(cronString {
            time(currentDateTime)
        })

        println("dateTime:")
        println(cronString {
            dateTime(currentDateTime)
        })

        println("am:")
        println(cronString {
            am(7,30)
        })
    }
}*/
